<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<SCRIPT LANGUAGE="JavaScript">
	function doOver() {
		var el = event.srcElement;
		cal_Day = el.title;

		if (cal_Day.length > 7) {
			el.style.borderTopColor = el.style.borderLeftColor = "buttonhighlight";
			el.style.borderRightColor = el.style.borderBottomColor = "buttonshadow";
		}
	}

	function doOut() {
		var el = event.srcElement;
		cal_Day = el.title;

		if (cal_Day.length > 7) {
			el.style.borderColor = "white";
		}
	}

	function day2(d) {																// 2자리 숫자료 변경
		var str = new String();
		
		if (parseInt(d) < 10) {
			str = "0" + parseInt(d);
		} else {
			str = "" + parseInt(d);
		}
		return str;
	}

	function Show_cal(sYear, sMonth, sDay, seper) {
		if(seper == undefined || seper == "") seper = "/";
		var Months_day = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31)
		//var Weekday_name = new Array("일", "월", "화", "수", "목", "금", "토");
		var intThisYear = new Number(), intThisMonth = new Number(), intThisDay = new Number();
		var cal = document.getElementById("cal");
		cal.innerHTML = "";
		datToday = new Date();													// 현재 날자 설정
		
		intThisYear = parseInt(sYear);
		intThisMonth = parseInt(sMonth);
		intThisDay = parseInt(sDay);
		
		if (intThisYear == 0) intThisYear = datToday.getFullYear();				// 값이 없을 경우
		if (intThisMonth == 0) intThisMonth = parseInt(datToday.getMonth())+1;	// 월 값은 실제값 보다 -1 한 값이 돼돌려 진다.
		if (intThisDay == 0) intThisDay = datToday.getDate();
		
		switch(intThisMonth) {
			case 1:
					intPrevYear = intThisYear -1;
					intPrevMonth = 12;
					intNextYear = intThisYear;
					intNextMonth = 2;
					break;
			case 12:
					intPrevYear = intThisYear;
					intPrevMonth = 11;
					intNextYear = intThisYear + 1;
					intNextMonth = 1;
					break;
			default:
					intPrevYear = intThisYear;
					intPrevMonth = parseInt(intThisMonth) - 1;
					intNextYear = intThisYear;
					intNextMonth = parseInt(intThisMonth) + 1;
					break;
		}
		intPPyear = intThisYear-1
		intNNyear = intThisYear+1

		NowThisYear = datToday.getFullYear();										// 현재 년
		NowThisMonth = datToday.getMonth()+1;										// 현재 월
		NowThisDay = datToday.getDate();											// 현재 일
		
		datFirstDay = new Date(intThisYear, intThisMonth-1, 1);						// 현재 달의 1일로 날자 객체 생성(월은 0부터 11까지의 정수(1월부터 12월))
		intFirstWeekday = datFirstDay.getDay();										// 현재 달 1일의 요일을 구함 (0:일요일, 1:월요일)
		
		intSecondWeekday = intFirstWeekday;
		intThirdWeekday = intFirstWeekday;
		
		datThisDay = new Date(intThisYear, intThisMonth, intThisDay);				// 넘어온 값의 날자 생성
		intThisWeekday = datThisDay.getDay();										// 넘어온 날자의 주 요일

		//varThisWeekday = Weekday_name[intThisWeekday];								// 현재 요일 저장
		
		intPrintDay = 1;																// 달의 시작 일자
		secondPrintDay = 1;
		thirdPrintDay = 1;

		Stop_Flag = 0
		
		if ((intThisYear % 4)==0) {													// 4년마다 1번이면 (사로나누어 떨어지면)
			if ((intThisYear % 100) == 0) {
				if ((intThisYear % 400) == 0) {
					Months_day[2] = 29;
				}
			} else {
				Months_day[2] = 29;
			}
		}
		intLastDay = Months_day[intThisMonth];										// 마지막 일자 구함

		Cal_HTML = "<table id='Cal_Table' border=0 bgcolor='#f4f4f4' cellpadding=1 cellspacing=1 width=100% onmouseover='doOver()' onmouseout='doOut()' style='font-size : 12;font-family:굴림;'>";
		Cal_HTML += "<tr align=center bgcolor='#f4f4f4'>";
		Cal_HTML += "<td colspan=7 align=center>";
		Cal_HTML += "<a style='cursor:pointer;' OnClick='Show_cal("+intPPyear+","+intThisMonth+","+intThisDay+",\""+seper+"\");'>&lt;&lt;&nbsp;</a> ";
		Cal_HTML += "&nbsp;<a style='cursor:pointer;' OnClick='Show_cal("+intPrevYear+","+intPrevMonth+","+intThisDay+",\""+seper+"\");'>◀</a> ";
		Cal_HTML += intThisYear +"년 "+ intThisMonth +"월";
		Cal_HTML += " <a style='cursor:pointer;' OnClick='Show_cal("+intNextYear+","+intNextMonth+","+intThisDay+",\""+seper+"\");'>▶</a>";
		Cal_HTML += "&nbsp;<a style='cursor:pointer;' OnClick='Show_cal("+intNNyear+","+intThisMonth+","+intThisDay+",\""+seper+"\");'>&nbsp;&gt;&gt; </a>";
		Cal_HTML += "</td></tr>";
		Cal_HTML += "<tr align=center bgcolor='#87B3D6' style='color:#2065DA;' >";
		Cal_HTML += "<td style='padding-top:3px;'><font color=black>일</td><td style='padding-top:3px;'><font color=black>월</td><td style='padding-top:3px;'><font color=black>화</td><td style='padding-top:3px;'><font color=black>수</td><td style='padding-top:3px;'><font color=black>목</td><td style='padding-top:3px;'><font color=black>금</td><td style='padding-top:3px;'><font color=black>토</td></font>";
		Cal_HTML += "</tr>";
			
		for (intLoopWeek=1; intLoopWeek < 7; intLoopWeek++) {						// 주단위 루프 시작, 최대 6주
			Cal_HTML += "<tr align=right bgcolor='white'>"
			for (intLoopDay=1; intLoopDay <= 7; intLoopDay++) {						// 요일단위 루프 시작, 일요일 부터
				if (intThirdWeekday > 0) {											// 첫주 시작일이 1보다 크면
					Cal_HTML += "<td>";
					intThirdWeekday--;
				} else {
					if (thirdPrintDay > intLastDay) {								// 입력 날짝 월말보다 크다면
						Cal_HTML += "<td>";
					} else {														// 입력날짜가 현재월에 해당 되면
						Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+day2(intThisMonth).toString()+seper+day2(thirdPrintDay).toString()+" style=\"cursor:pointer;border:1px solid white;";
						if (intThisYear == NowThisYear && intThisMonth==NowThisMonth && thirdPrintDay==intThisDay) {
							Cal_HTML += "background-color:#C6F2ED;";
						}
						
						switch(intLoopDay) {
							case 1:													// 일요일이면 빨간 색으로
								Cal_HTML += "color:red;"
								break;
							//case 7:
							//	Cal_HTML += "color:blue;"
							//	break;
							default:
								Cal_HTML += "color:black;"
								break;
						}
						
						Cal_HTML += "\">"+thirdPrintDay;
						
					}
					thirdPrintDay++;
					
					if (thirdPrintDay > intLastDay) {								// 만약 날짜 값이 월말 값보다 크면 루프문 탈출
						Stop_Flag = 1;
					}
				}
				Cal_HTML += "</td>";
			}
			Cal_HTML += "</tr>";
			if (Stop_Flag==1) break;
		}
		Cal_HTML += "</table>";
		cal.innerHTML = Cal_HTML;

		// 달력 출력이 완료되면 iframe의 크기를 재조정한다.
		var Cal_Table = document.getElementById("Cal_Table");
		parent.resizeIframe(160, Cal_Table.offsetHeight+4);
	}

	function Show_cal_M(sYear, sMonth, seper) {
		if(seper == undefined || seper == "") seper = "/";
		//var Weekday_name = new Array("일", "월", "화", "수", "목", "금", "토");
		var intThisYear = new Number(), intThisMonth = new Number()
		var cal = document.getElementById("cal");
		cal.innerHTML = "";
		datToday = new Date();	
		
		intThisYear = parseInt(sYear);
		intThisMonth = parseInt(sMonth);
		
		if (intThisYear == 0) intThisYear = datToday.getFullYear();				// 값이 없을 경우
		if (intThisMonth == 0) intThisMonth = parseInt(datToday.getMonth())+1;	// 월 값은 실제값 보다 -1 한 값이 돼돌려 진다.
				
		switch(intThisMonth) {
			case 1:
					intPrevYear = intThisYear -1;
					intNextYear = intThisYear;
					break;
			case 12:
					intPrevYear = intThisYear;
					intNextYear = intThisYear + 1;
					break;
			default:
					intPrevYear = intThisYear;
					intNextYear = intThisYear;
					break;
		}
		intPPyear = intThisYear-1
		intNNyear = intThisYear+1

		Stop_Flag = 0

		Cal_HTML = "<table id='Cal_Table' border=0 bgcolor='#f4f4f4' cellpadding=1 cellspacing=1 width=100% onmouseover='doOver()' onmouseout='doOut()' style='font-size : 12;font-family:굴림;'>";
		Cal_HTML += "<tr align=center bgcolor='#f4f4f4'>";
		Cal_HTML += "<td colspan=4 align=center>";
		Cal_HTML += "<a style='cursor:pointer;' OnClick='Show_cal_M("+intPPyear+","+intThisMonth+",\""+seper+"\");'>◀</a>&nbsp;&nbsp;";
		Cal_HTML += intThisYear +"년";
		Cal_HTML += "&nbsp;&nbsp;<a style='cursor:pointer;' OnClick='Show_cal_M("+intNNyear+","+intThisMonth+",\""+seper+"\");'>▶</a>";
		Cal_HTML += "</td></tr>";
		Cal_HTML += "<tr align=center bgcolor=white>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"01"+" style=\"cursor:pointer;\">1월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"02"+" style=\"cursor:pointer;\">2월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"03"+" style=\"cursor:pointer;\">3월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"04"+" style=\"cursor:pointer;\">4월</td>";
		Cal_HTML += "</tr>";
		Cal_HTML += "<tr align=center bgcolor=white>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"05"+" style=\"cursor:pointer;\">5월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"06"+" style=\"cursor:pointer;\">6월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"07"+" style=\"cursor:pointer;\">7월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"08"+" style=\"cursor:pointer;\">8월</td>";
		Cal_HTML += "</tr>";
		Cal_HTML += "<tr align=center bgcolor=white>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"09"+" style=\"cursor:pointer;\">9월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"10"+" style=\"cursor:pointer;\">10월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"11"+" style=\"cursor:pointer;\">11월</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"12"+" style=\"cursor:pointer;\">12월</td>";
		Cal_HTML += "</tr>";
		Cal_HTML += "</table>";
		cal.innerHTML = Cal_HTML;

		// 달력 출력이 완료되면 iframe의 크기를 재조정한다.
		var Cal_Table = document.getElementById("Cal_Table");
		parent.resizeIframe(160, Cal_Table.offsetHeight+4);
	}

	//분기정보
	function Show_cal_P(sYear, sMonth, seper) {
		var intThisYear = new Number(), intThisMonth = new Number()
		document.all.cal.innerHTML = "";
		datToday = new Date();	
		
		intThisYear = parseInt(sYear);
		intThisMonth = parseInt(sMonth);
		
		if (intThisYear == 0) intThisYear = datToday.getFullYear();				// 값이 없을 경우
		if (intThisMonth == 0) intThisMonth = parseInt(datToday.getMonth())+1;	// 월 값은 실제값 보다 -1 한 값이 돼돌려 진다.
				
		switch(intThisMonth) {
			case 1:
					intPrevYear = intThisYear -1;
					intNextYear = intThisYear;
					break;
			case 12:
					intPrevYear = intThisYear;
					intNextYear = intThisYear + 1;
					break;
			default:
					intPrevYear = intThisYear;
					intNextYear = intThisYear;
					break;
		}
		intPPyear = intThisYear-1
		intNNyear = intThisYear+1

		Stop_Flag = 0

		Cal_HTML = "<table id=Cal_Table border=0 bgcolor='#f4f4f4' cellpadding=1 cellspacing=1 width=100% onmouseover='doOver()' onmouseout='doOut()' style='font-size : 12;font-family:굴림;'>";
		Cal_HTML += "<tr align=center bgcolor='#f4f4f4'>";
		Cal_HTML += "<td colspan=4 align=center>";
		Cal_HTML += "<a style='cursor:pointer;' OnClick='Show_cal_P("+intPPyear+","+intThisMonth+",\""+seper+"\");'>◀</a>&nbsp;&nbsp;";
		Cal_HTML += intThisYear +"년";
		Cal_HTML += "&nbsp;&nbsp;<a style='cursor:pointer;' OnClick='Show_cal_P("+intNNyear+","+intThisMonth+",\""+seper+"\");'>▶</a>";
		Cal_HTML += "</td></tr>";
		Cal_HTML += "<tr align=center bgcolor=white>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"1"+" style=\"cursor:pointer;\">1분기</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"2"+" style=\"cursor:pointer;\">2분기</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"3"+" style=\"cursor:pointer;\">3분기</td>";
		Cal_HTML += "<td onClick=parent.Calendar_Click(this); title="+intThisYear+seper+"4"+" style=\"cursor:pointer;\">4분기</td>";
		Cal_HTML += "</tr>";
		Cal_HTML += "</table>";
		document.all.cal.innerHTML = Cal_HTML;
		// 달력 출력이 완료되면 iframe의 크기를 재조정한다.
		var Cal_Table = document.getElementById("Cal_Table");
		parent.resizeIframe(160, Cal_Table.offsetHeight+4);
	}
</SCRIPT>

<body style="margin:2">
	<div id="cal"></div>		
</body>
</html>